<?php
require_once '../include.php';
$rows = getProAllId();#获取列表数组
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>商品图片列表</title>
    <link rel="stylesheet" href="style/backstage.css">
</head>

<body>
<div class="details">
    <h3>商品图片列表</h3> <br>
    <div class="details_operation clearfix">
        <div class="bui_select">
            <input type="button" value="添&nbsp;&nbsp;加" class="add"  onclick="addAdmin()">
        </div>
        <div class="fr">
            <div class="text">
                <span>商品价格：</span>
                <div class="bui_select">
                    <select class="select" onchange="change(this.value)">
                        <option>-请选择-</option>
                        <option value="iPrice asc">由低到高</option>
                        <option value="iPrice desc">由高到低</option>
                    </select>
                </div>
            </div>
            <div class="text">
                <span>上架时间：</span>
                <div class="bui_select">
                    <select class="select" onchange="change(this.value)">
                        <option>-请选择-</option>
                        <option value="pubTime desc">最新发布</option>
                        <option value="pubTime asc">历史发布</option>
                    </select>
                </div>
            </div>
            <div class="text">
                <span>搜索</span>
                <input type="text" class="search" id="search" onkeypress="search()">
            </div>
        </div>
        <!--表格-->
        <table class="table" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th width="15%">编号</th>
                    <th width="25%">商品名称</th>
                    <th width="30%">商品图片</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <?php  foreach($rows as $row): ?>
                <tr>
                    <!--这里的id和for里面的c1 需要循环出来-->
                    <td>
                        <input type="checkbox" id="c<?php echo $row['id'];?>" class="check" value="<?php echo $row['id']?>">
                        <label for="c1" class="label"><?php echo $row['id'];?></label>
                    </td>
                    <td><?php echo $row['pName'];?></td>
                    <td>
                        <?php $proImg = getAllImgByProId($row['id']);foreach ($proImg as $k):?>
                            <img src="uploads/<?php echo $k['albumPath'];?>" alt="" width="100" height="100" />
                        <?php endforeach; ?>
                    </td>
                    <td align="center">
                        <input type="button" value="添加文字水印" class="btn" onclick="doImg(<?php echo $row['id'];?>,'waterText')">
                        <input type="button" value="添加图片水印" class="btn"  onclick="doImg(<?php echo $row['id'];?>,'waterPic')">
                    </td>
                </tr>
            <?php endforeach;?>
            </tbody>
        </table>
    </div>
</div>
</body>
<script type="text/javascript">
    function doImg(id,act){
        window.location="doAdminAction.php?act="+act+"&id="+id;
    }
</script>
</html>